<template>
    <div>
        <!-- 面包屑导航区域 -->
        <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>参与单位管理</el-breadcrumb-item>
        </el-breadcrumb>

        <!-- 卡片视图区域 -->
        <el-card>
            <el-row :gutter="20">
                <el-col :span="6">
                    <el-select v-model="value" placeholder="请选择参与单位">
                        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
                        </el-option>
                    </el-select>
                </el-col>
                <el-col :span="6">
                    <el-input placeholder="请输入单位类型" v-model="queryInfo.query" clearable @clear="gettableData">
                        <el-button slot="append" icon="el-icon-search" @click="gettableData"></el-button>
                    </el-input>
                </el-col>
                <el-col :span="2">
                    <el-button class="clear-button" type="primary" @click="clear" size="mini">重置</el-button>
                </el-col>
                <el-col :span="1">
                    <el-button class="search-button" type="primary" @click="search" size="mini">查询</el-button>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="2">
                    <el-button class="xinzeng-button" type="primary" @click="xinzeng" size="mini">新建单位</el-button>
                </el-col>
            </el-row>

            <el-table :data="tableData" border stripe style="width: 100%">
                <!-- <el-table-column type="index"></el-table-column> -->
                <el-table-column label="序号" prop="unit_id" width="70">
                </el-table-column>
                <el-table-column label="单位名称" prop="unit_name" width="200">
                </el-table-column>
                <el-table-column label="单位类别" prop="unit_category" width="100">
                </el-table-column>
                <el-table-column label="社会信用代码" prop="credit_code" width="200">
                </el-table-column>
                <el-table-column label="联系人" prop="contact" width="100">
                </el-table-column>
                <el-table-column label="联系方式" prop="contact_phone" width="180">
                </el-table-column>
                <el-table-column label="操作" width="150">
                    <template>
                        <el-button type="primary" icon="el-icon-edit" circle size="mini"></el-button>
                        <el-button type="danger" icon="el-icon-delete" circle size="mini"></el-button>
                    </template>
                </el-table-column>
            </el-table>

            <!-- 分页区域 -->
            <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                :current-page="queryInfo.pagenum" :page-sizes="[1, 3, 5, 10]" :page-size="queryInfo.pagesize"
                layout="total, sizes, prev, pager, next, jumper" :total="2">
            </el-pagination>
        </el-card>
    </div>
</template>

<script>
export default {
    data() {
        return {
            tableData: [{
                unit_id: 1,
                unit_name: <el-button type="text">重庆交通大学-南岸校区</el-button>,
                unit_category: '承包商',
                credit_code: '12500000450401979R',
                contact: '张某某',
                contact_phone: '12345678907'
            },
            {
                unit_id: 2,
                unit_name: <el-button type="text">重庆交通大学-双福校区</el-button>,
                unit_category: "承包商",
                credit_code: "12500000450401979R",
                contact: "李某某",
                contact_phone: "12749822445"
            }],
            queryInfo: {
                query: '',
                //当前的页数
                pagenum: 1,
                //当前每页显示多少条数据
                pagesize: 2
            },
            // userlist: [],
             total: 2
        }
    },
    created() {
        // this.getUserList()
        this.gettableData()
    },
    methods: {
        //监听pagesize改变的事件
        handleSizeChange(val) {
            console.log(`每页 ${val} 条`);
            // this.queryInfo.pagesize=val
            // this.gettableData()
        },
        //监听页码值改变的事件
        handleCurrentChange(val) {
            console.log(`当前页: ${val}`);
        },
        xinzeng(){
            this.$router.push('/src/components/department/Xin-zeng.vue')
        },
        clear(){

        },
        search(){

        },
        // async getUserList() {
        //     const { data: res } = await this.$http.get('users', { params: this.queryInfo })
        //     if (res.data.status !== 200) return this.$message.error('获取用户列表失败')
        //     this.userlist = res.data.users
        //     this.total = res.data.total
        //     console.log(res)
        // }
    }
}
</script>

<style lang="less" scoped>

.xinzeng-button{
    background-color: #909399;
    font-size: 8px;
    line-height: 8px;
    color: #fff;
    text-align: center;
    cursor: pointer;
    margin-top: 10px;
}

.clear-button{
    background-color: #909399;
    font-size: 8px;
    line-height: 8px;
    color: #fff;
    text-align: center;
    cursor: pointer;
    margin-top: 10px;
}

.search-button{
    background-color: #909399;
    font-size: 8px;
    line-height: 8px;
    color: #fff;
    text-align: center;
    cursor: pointer;
    margin-top: 10px;
}
</style>